import React from "react";

import Constants from "../../common/Constants";
import BaseAction from "../common/BaseAction";

export default class SportRequestSelfDataAction extends BaseAction {
  constructor(props) {
    super(props);

    this.moduleType = Constants.MODULE_TYPE.SPORT;
    this.name = "SportRequestSelfDataAction";
  }

  _dealCall(caller, data) {
    caller.setState({
      viewStatus: 2
    });
  }

  finish(data, isSucceed, response) {
    if (isSucceed) {
      data.beenUpdated = false;
      this.caller.setState({
        sportData: data,
        updateSelfData: true
      });
    } else if (response) {
      if (response.status === 401) {
        this._dealUnauthorized(this.caller);
      } else {
        this.caller.setState({ viewStatus: response.status });
      }
    } else if (data.status === 404) {
    }
  }
}
